<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<script src="js/mui.min.js"></script>
		<script type="text/javascript" charset="utf-8">
			mui.init();
		</script>
		<link rel="stylesheet" href="css/fonts/index.css"></link>
	</head>

	<body>
		<div id="biggest" class="mui-content flex-container">
			<div id="title" class="indexTitle flex-item">
				<div style="margin-top: 1.8rem;">Chinese Food Take Out</div>
				<div>Restaurant</div>
			</div>
			<div id="center" class="flex-item" style="margin-top: 5.6rem;">
				<div style="margin-left: -9.1rem;">
					<div class="whiteBlock">
						<div class="cro_right_bottom"></div>
					</div>
					<div class="greyBlock">
						<div class="cro_right_top"></div>
					</div>
				</div>
				<div style="margin-top: -9.98rem;">
					<div class="whiteBlock">
						<div class="cro_right_bottom"></div>
						<div class="cro_left_bottom"></div>
						<div align="center">
							<img src="imges/img.png" style="margin-top: -1.8rem; border-radius: 0.2rem; width: 7.5rem; box-shadow: 1px 1px 5px gray;" />
						</div>
						<div class="Woke_On_By" style="width: 100%; text-align: center; padding-top: 0.4rem;">Woke On By</div>
						<div class="New_York_Style" style="width: 100%; text-align: center; margin-top: 1.2rem;">New York Style</div>
					</div>
					<div class="greyBlock" align="center">
						<div class="cro_right_top"></div>
						<div class="cro_left_top"></div>
						<div id="goOn" class="orange" style="margin-top: 0.85rem;">
							<img src="imges/home.png" style="margin-left: -1.7rem; margin-top: 0.25rem; width: 0.7rem;" />
							<div class="button_text" style="margin-left: 0.9rem; margin-top: -0.87rem;">DINE IN</div>
						</div>
						<div id="goOn2" class="orange" style="margin-top: 2.65rem;">
							<img src="imges/takeaway.png" style="margin-left: -1.7rem; margin-top: 0.2rem; width: 0.6rem;" />
							<div class="button_text" style="margin-left: 1.6rem; margin-top: -0.87rem;">TAKE AWAY</div>
						</div>
					</div>
				</div>
				<div style="margin-top: -9.98rem; margin-left: 9rem;">
					<div class="whiteBlock">
						<div class="cro_right_bottom"></div>
						<div class="cro_left_bottom"></div>
					</div>
					<div class="greyBlock">
						<div class="cro_right_top"></div>
						<div class="cro_left_top"></div>
					</div>
				</div>
			</div>
			<div class="Tel" href="login.html">
				Tel:(813)961-8372
			</div>
		</div>

		<script src="js/mui.min.js"></script>
		<script src="js/jquery.min.js"></script>
		<script type="text/javascript">
			document.addEventListener('DOMContentLoaded', function() {
				var html = document.documentElement;
				var windowWidth = html.clientWidth;
				html.style.fontSize = windowWidth / 10.8 + 'px';
			}, false);
			var wgtVer = null;

			function plusReady() {
				// 获取本地应用资源版本号
				plus.runtime.getProperty(plus.runtime.appid, function(inf) {
					wgtVer = inf.version;
					checkUpdate();
					console.log("当前应用版本：" + wgtVer);
				});
			}
			if(window.plus) {
				plusReady();
			} else {
				document.addEventListener('plusready', plusReady, false);
			}


			function checkUpdate() {
						mui.ajax("http://api.jhjnzx.com/api/Normal/GetData", {
						data: {
							procName: "N_GetVersionNumber",
							args: ''
						},
						dataType: 'json',
						method: 'get',
						success: function(data) {
							returnData = JSON.parse(data);
							//alert(returnData);
							//alert(wgtVer);
							if(wgtVer && returnData && (wgtVer != returnData)) {
									//alert('11')
									downWgt(); // 下载升级包
								}
						},
						error: function(xhr, type, errorThrown) {
							//异常处理；
							console.log(type);
						}
					});
				
			}

			var wgtUrl = "http://api.yongcjy.com/update/H5DF5E650.wgt";

			function downWgt() {
				plus.nativeUI.showWaiting("下载文件...");
				plus.downloader.createDownload(wgtUrl, {
					filename: "_doc/update/"
				}, function(d, status) {
					if(status == 200) {
						console.log("下载成功：" + d.filename);
						installWgt(d.filename); // 安装wgt包
					} else {
						console.log("下载失败！");
						plus.nativeUI.alert("下载失败！");
					}
					plus.nativeUI.closeWaiting();
				}).start();
			}

			// 更新应用资源
			function installWgt(path) {
				plus.nativeUI.showWaiting("安装文件...");
				plus.runtime.install(path, {}, function() {
					plus.nativeUI.closeWaiting();
					console.log("安装文件成功！");
					plus.nativeUI.alert("应用资源更新完成！", function() {
						plus.runtime.restart();
					});
				}, function(e) {
					plus.nativeUI.closeWaiting();
					console.log("安装文件失败[" + e.code + "]：" + e.message);
					plus.nativeUI.alert("安装文件失败[" + e.code + "]：" + e.message);
				});
			}
			
			document.getElementById('goOn').addEventListener('tap', function() {
				window.location = 'main.html';
			});
			document.getElementById('goOn2').addEventListener('tap', function() {
				window.location = 'main.html';
			});
		</script>
	</body>

</html>